
install_data('index.theme',
  install_dir: gimpiconsdir / theme,
)

legacy_icons_12 = [
  '12/gimp-close.png',
  '12/gimp-default-colors.png',
  '12/gimp-linked.png',
  '12/gimp-menu-left.png',
  '12/gimp-menu-right.png',
  '12/gimp-quick-mask-off.png',
  '12/gimp-quick-mask-on.png',
  '12/gimp-swap-colors.png',
  '12/gimp-visible.png',
  '12/gimp-zoom-follow-window.png',
]
legacy_icons_16 = [
  '16/gimp-anchor.png',
  '16/gimp-cap-butt.png',
  '16/gimp-cap-round.png',
  '16/gimp-cap-square.png',
  '16/gimp-center.png',
  '16/gimp-channel-alpha.png',
  '16/gimp-channel-blue.png',
  '16/gimp-channel-gray.png',
  '16/gimp-channel-green.png',
  '16/gimp-channel-indexed.png',
  '16/gimp-channel-red.png',
  '16/gimp-channel.png',
  '16/gimp-channels.png',
  '16/gimp-color-pick-from-screen.png',
  '16/gimp-color-triangle.png',
  '16/gimp-colormap.png',
  '16/gimp-controller-keyboard.png',
  '16/gimp-controller-linux-input.png',
  '16/gimp-controller-midi.png',
  '16/gimp-controller-wheel.png',
  '16/gimp-controller.png',
  '16/gimp-convert-grayscale.png',
  '16/gimp-convert-indexed.png',
  '16/gimp-convert-rgb.png',
  '16/gimp-cursor.png',
  '16/gimp-curve-free.png',
  '16/gimp-curve-smooth.png',
  '16/gimp-device-status.png',
  '16/gimp-display-filter-colorblind.png',
  '16/gimp-display-filter-contrast.png',
  '16/gimp-display-filter-gamma.png',
  '16/gimp-display-filter-lcms.png',
  '16/gimp-display-filter-proof.png',
  '16/gimp-display-filter.png',
  '16/gimp-duplicate.png',
  '16/gimp-dynamics.png',
  '16/gimp-flip-horizontal.png',
  '16/gimp-flip-vertical.png',
  '16/gimp-floating-selection.png',
  '16/gimp-gegl.png',
  '16/gimp-gradient-bilinear.png',
  '16/gimp-gradient-conical-asymmetric.png',
  '16/gimp-gradient-conical-symmetric.png',
  '16/gimp-gradient-linear.png',
  '16/gimp-gradient-radial.png',
  '16/gimp-gradient-shapeburst-angular.png',
  '16/gimp-gradient-shapeburst-dimpled.png',
  '16/gimp-gradient-shapeburst-spherical.png',
  '16/gimp-gradient-spiral-anticlockwise.png',
  '16/gimp-gradient-spiral-clockwise.png',
  '16/gimp-gradient-square.png',
  '16/gimp-grid.png',
  '16/gimp-histogram-linear.png',
  '16/gimp-histogram-logarithmic.png',
  '16/gimp-histogram.png',
  '16/gimp-image.png',
  '16/gimp-images.png',
  '16/gimp-info.png',
  '16/gimp-input-device.png',
  '16/gimp-invert.png',
  '16/gimp-join-bevel.png',
  '16/gimp-join-miter.png',
  '16/gimp-join-round.png',
  '16/gimp-landscape.png',
  '16/gimp-layer-mask.png',
  '16/gimp-layer-to-imagesize.png',
  '16/gimp-layer.png',
  '16/gimp-layers.png',
  '16/gimp-list.png',
  '16/gimp-merge-down.png',
  '16/gimp-move-to-screen.png',
  '16/gimp-navigation.png',
  '16/gimp-paste-as-new.png',
  '16/gimp-paste-into.png',
  '16/gimp-path-stroke.png',
  '16/gimp-path.png',
  '16/gimp-paths.png',
  '16/gimp-plugin.png',
  '16/gimp-portrait.png',
  '16/gimp-prefs-folders-brushes.png',
  '16/gimp-prefs-folders-dynamics.png',
  '16/gimp-prefs-folders-environ.png',
  '16/gimp-prefs-folders-fonts.png',
  '16/gimp-prefs-folders-gradients.png',
  '16/gimp-prefs-folders-icon-themes.png',
  '16/gimp-prefs-folders-interp.png',
  '16/gimp-prefs-folders-modules.png',
  '16/gimp-prefs-folders-palettes.png',
  '16/gimp-prefs-folders-patterns.png',
  '16/gimp-prefs-folders-plug-ins.png',
  '16/gimp-prefs-folders-scripts.png',
  '16/gimp-prefs-folders-themes.png',
  '16/gimp-prefs-folders-tool-plug-ins.png',
  '16/gimp-prefs-folders-tool-presets.png',
  '16/gimp-prefs-folders-tools.png',
  '16/gimp-prefs-icon-theme.png',
  '16/gimp-prefs-image-windows.png',
  '16/gimp-prefs-interface.png',
  '16/gimp-prefs-theme.png',
  '16/gimp-prefs-toolbox.png',
  '16/gimp-prefs-window-management.png',
  '16/gimp-print-resolution.png',
  '16/gimp-reset.png',
  '16/gimp-reshow-filter.png',
  '16/gimp-resize.png',
  '16/gimp-rotate-180.png',
  '16/gimp-rotate-270.png',
  '16/gimp-rotate-90.png',
  '16/gimp-sample-point.png',
  '16/gimp-scale.png',
  '16/gimp-selection-add.png',
  '16/gimp-selection-all.png',
  '16/gimp-selection-border.png',
  '16/gimp-selection-grow.png',
  '16/gimp-selection-intersect.png',
  '16/gimp-selection-none.png',
  '16/gimp-selection-replace.png',
  '16/gimp-selection-shrink.png',
  '16/gimp-selection-stroke.png',
  '16/gimp-selection-subtract.png',
  '16/gimp-selection-to-channel.png',
  '16/gimp-selection-to-path.png',
  '16/gimp-selection.png',
  '16/gimp-shape-circle.png',
  '16/gimp-shape-diamond.png',
  '16/gimp-shape-square.png',
  '16/gimp-template.png',
  '16/gimp-text-layer.png',
  '16/gimp-toilet-paper.png',
  '16/gimp-tool-airbrush.png',
  '16/gimp-tool-align.png',
  '16/gimp-tool-blur.png',
  '16/gimp-tool-brightness-contrast.png',
  '16/gimp-tool-bucket-fill.png',
  '16/gimp-tool-by-color-select.png',
  '16/gimp-tool-cage.png',
  '16/gimp-tool-clone.png',
  '16/gimp-tool-color-balance.png',
  '16/gimp-tool-color-picker.png',
  '16/gimp-tool-colorize.png',
  '16/gimp-tool-crop.png',
  '16/gimp-tool-curves.png',
  '16/gimp-tool-desaturate.png',
  '16/gimp-tool-dodge.png',
  '16/gimp-tool-ellipse-select.png',
  '16/gimp-tool-eraser.png',
  '16/gimp-tool-flip.png',
  '16/gimp-tool-foreground-select.png',
  '16/gimp-tool-free-select.png',
  '16/gimp-tool-fuzzy-select.png',
  '16/gimp-tool-gradient.png',
  '16/gimp-tool-handle-transform.png',
  '16/gimp-tool-heal.png',
  '16/gimp-tool-hue-saturation.png',
  '16/gimp-tool-ink.png',
  '16/gimp-tool-iscissors.png',
  '16/gimp-tool-levels.png',
  '16/gimp-tool-measure.png',
  '16/gimp-tool-move.png',
  '16/gimp-tool-mypaint-brush.png',
  '16/gimp-tool-n-point-deformation.png',
  '16/gimp-tool-options.png',
  '16/gimp-tool-paintbrush.png',
  '16/gimp-tool-path.png',
  '16/gimp-tool-pencil.png',
  '16/gimp-tool-perspective-clone.png',
  '16/gimp-tool-perspective.png',
  '16/gimp-tool-posterize.png',
  '16/gimp-tool-preset.png',
  '16/gimp-tool-rect-select.png',
  '16/gimp-tool-rotate.png',
  '16/gimp-tool-scale.png',
  '16/gimp-tool-seamless-clone.png',
  '16/gimp-tool-shear.png',
  '16/gimp-tool-smudge.png',
  '16/gimp-tool-text.png',
  '16/gimp-tool-threshold.png',
  '16/gimp-tool-unified-transform.png',
  '16/gimp-tool-warp.png',
  '16/gimp-tool-zoom.png',
  '16/gimp-tools.png',
  '16/gimp-transparency.png',
  '16/gimp-undo-history.png',
  '16/gimp-user-manual.png',
  '16/gimp-video.png',
  '16/gimp-warning.png',
  '16/gimp-web.png',
  '16/gimp-wilber.png',
  '16/gtk-edit.png',
]
legacy_icons_18 = [
  '18/gimp-color-picker-black.png',
  '18/gimp-color-picker-gray.png',
  '18/gimp-color-picker-white.png',
]
legacy_icons_20 = [
  '20/gimp-linked.png',
  '20/gimp-visible.png',
]
legacy_icons_22 = [
  '22/gimp-char-picker.png',
  '22/gimp-dynamics.png',
  '22/gimp-histogram.png',
  '22/gimp-input-device.png',
  '22/gimp-letter-spacing.png',
  '22/gimp-line-spacing.png',
  '22/gimp-path.png',
  '22/gimp-paths.png',
  '22/gimp-prefs-color-management.png',
  '22/gimp-prefs-controllers.png',
  '22/gimp-prefs-default-grid.png',
  '22/gimp-prefs-display.png',
  '22/gimp-prefs-folders-brushes.png',
  '22/gimp-prefs-folders-dynamics.png',
  '22/gimp-prefs-folders-environ.png',
  '22/gimp-prefs-folders-fonts.png',
  '22/gimp-prefs-folders-gradients.png',
  '22/gimp-prefs-folders-icon-themes.png',
  '22/gimp-prefs-folders-interp.png',
  '22/gimp-prefs-folders-modules.png',
  '22/gimp-prefs-folders-palettes.png',
  '22/gimp-prefs-folders-patterns.png',
  '22/gimp-prefs-folders-plug-ins.png',
  '22/gimp-prefs-folders-scripts.png',
  '22/gimp-prefs-folders-themes.png',
  '22/gimp-prefs-folders-tool-plug-ins.png',
  '22/gimp-prefs-folders-tool-presets.png',
  '22/gimp-prefs-folders-tools.png',
  '22/gimp-prefs-folders.png',
  '22/gimp-prefs-help-system.png',
  '22/gimp-prefs-icon-theme.png',
  '22/gimp-prefs-image-title.png',
  '22/gimp-prefs-image-windows.png',
  '22/gimp-prefs-input-devices.png',
  '22/gimp-prefs-interface.png',
  '22/gimp-prefs-new-image.png',
  '22/gimp-prefs-playground.png',
  '22/gimp-prefs-session.png',
  '22/gimp-prefs-system-resources.png',
  '22/gimp-prefs-theme.png',
  '22/gimp-prefs-tool-options.png',
  '22/gimp-prefs-toolbox.png',
  '22/gimp-prefs-window-management.png',
  '22/gimp-tool-preset.png',
  '22/gimp-wilber.png',
]
legacy_tools_22 = [
  '22/gimp-gegl.png',
  '22/gimp-tool-airbrush.png',
  '22/gimp-tool-align.png',
  '22/gimp-tool-blur.png',
  '22/gimp-tool-brightness-contrast.png',
  '22/gimp-tool-bucket-fill.png',
  '22/gimp-tool-by-color-select.png',
  '22/gimp-tool-cage.png',
  '22/gimp-tool-clone.png',
  '22/gimp-tool-color-balance.png',
  '22/gimp-tool-color-picker.png',
  '22/gimp-tool-colorize.png',
  '22/gimp-tool-crop.png',
  '22/gimp-tool-curves.png',
  '22/gimp-tool-desaturate.png',
  '22/gimp-tool-dodge.png',
  '22/gimp-tool-ellipse-select.png',
  '22/gimp-tool-eraser.png',
  '22/gimp-tool-flip.png',
  '22/gimp-tool-foreground-select.png',
  '22/gimp-tool-free-select.png',
  '22/gimp-tool-fuzzy-select.png',
  '22/gimp-tool-gradient.png',
  '22/gimp-tool-handle-transform.png',
  '22/gimp-tool-heal.png',
  '22/gimp-tool-hue-saturation.png',
  '22/gimp-tool-ink.png',
  '22/gimp-tool-iscissors.png',
  '22/gimp-tool-levels.png',
  '22/gimp-tool-measure.png',
  '22/gimp-tool-move.png',
  '22/gimp-tool-mypaint-brush.png',
  '22/gimp-tool-n-point-deformation.png',
  '22/gimp-tool-paintbrush.png',
  '22/gimp-tool-path.png',
  '22/gimp-tool-pencil.png',
  '22/gimp-tool-perspective-clone.png',
  '22/gimp-tool-perspective.png',
  '22/gimp-tool-posterize.png',
  '22/gimp-tool-rect-select.png',
  '22/gimp-tool-rotate.png',
  '22/gimp-tool-scale.png',
  '22/gimp-tool-seamless-clone.png',
  '22/gimp-tool-shear.png',
  '22/gimp-tool-smudge.png',
  '22/gimp-tool-text.png',
  '22/gimp-tool-threshold.png',
  '22/gimp-tool-unified-transform.png',
  '22/gimp-tool-warp.png',
  '22/gimp-tool-zoom.png',
]
legacy_icons_24 = [
  '24/gimp-center.png',
  '24/gimp-channel-alpha.png',
  '24/gimp-channel-blue.png',
  '24/gimp-channel-gray.png',
  '24/gimp-channel-green.png',
  '24/gimp-channel-indexed.png',
  '24/gimp-channel-red.png',
  '24/gimp-channel.png',
  '24/gimp-channels.png',
  '24/gimp-colormap.png',
  '24/gimp-controller-keyboard.png',
  '24/gimp-controller-linux-input.png',
  '24/gimp-controller-midi.png',
  '24/gimp-controller-wheel.png',
  '24/gimp-controller.png',
  '24/gimp-cursor.png',
  '24/gimp-device-status.png',
  '24/gimp-display-filter-colorblind.png',
  '24/gimp-display-filter-contrast.png',
  '24/gimp-display-filter-gamma.png',
  '24/gimp-display-filter-lcms.png',
  '24/gimp-display-filter-proof.png',
  '24/gimp-display-filter.png',
  '24/gimp-floating-selection.png',
  '24/gimp-gravity-east.png',
  '24/gimp-gravity-north-east.png',
  '24/gimp-gravity-north-west.png',
  '24/gimp-gravity-north.png',
  '24/gimp-gravity-south-east.png',
  '24/gimp-gravity-south-west.png',
  '24/gimp-gravity-south.png',
  '24/gimp-gravity-west.png',
  '24/gimp-hcenter.png',
  '24/gimp-hchain-broken.png',
  '24/gimp-hchain.png',
  '24/gimp-hfill.png',
  '24/gimp-image.png',
  '24/gimp-images.png',
  '24/gimp-info.png',
  '24/gimp-layer-mask.png',
  '24/gimp-layer.png',
  '24/gimp-layers.png',
  '24/gimp-move-to-screen.png',
  '24/gimp-print-resolution.png',
  '24/gimp-sample-point.png',
  '24/gimp-template.png',
  '24/gimp-text-dir-ltr.png',
  '24/gimp-text-dir-rtl.png',
  '24/gimp-text-layer.png',
  '24/gimp-toilet-paper.png',
  '24/gimp-tool-options.png',
  '24/gimp-tools.png',
  '24/gimp-transparency.png',
  '24/gimp-undo-history.png',
  '24/gimp-user-manual.png',
  '24/gimp-vcenter.png',
  '24/gimp-vchain-broken.png',
  '24/gimp-vchain.png',
  '24/gimp-vfill.png',
  '24/gimp-video.png',
  '24/gimp-warning.png',
  '24/gimp-web.png',
]
legacy_icons_32 = [
  '32/gimp-channel-alpha.png',
  '32/gimp-channel-blue.png',
  '32/gimp-channel-gray.png',
  '32/gimp-channel-green.png',
  '32/gimp-channel-indexed.png',
  '32/gimp-channel-red.png',
  '32/gimp-channel.png',
  '32/gimp-floating-selection.png',
  '32/gimp-image.png',
  '32/gimp-layer-mask.png',
  '32/gimp-layer.png',
  '32/gimp-text-layer.png',
  '32/gimp-user-manual.png',
  '32/gimp-wilber.png',
]
legacy_icons_48 = [
  '48/gimp-channel-alpha.png',
  '48/gimp-channel-blue.png',
  '48/gimp-channel-gray.png',
  '48/gimp-channel-green.png',
  '48/gimp-channel-indexed.png',
  '48/gimp-channel-red.png',
  '48/gimp-channel.png',
  '48/gimp-floating-selection.png',
  '48/gimp-image.png',
  '48/gimp-layer-mask.png',
  '48/gimp-layer.png',
  '48/gimp-prefs-color-management.png',
  '48/gimp-prefs-controllers.png',
  '48/gimp-prefs-default-comment.png',
  '48/gimp-prefs-default-grid.png',
  '48/gimp-prefs-display.png',
  '48/gimp-prefs-folders-brushes.png',
  '48/gimp-prefs-folders-dynamics.png',
  '48/gimp-prefs-folders-environ.png',
  '48/gimp-prefs-folders-fonts.png',
  '48/gimp-prefs-folders-gradients.png',
  '48/gimp-prefs-folders-icon-themes.png',
  '48/gimp-prefs-folders-interp.png',
  '48/gimp-prefs-folders-modules.png',
  '48/gimp-prefs-folders-palettes.png',
  '48/gimp-prefs-folders-patterns.png',
  '48/gimp-prefs-folders-plug-ins.png',
  '48/gimp-prefs-folders-scripts.png',
  '48/gimp-prefs-folders-themes.png',
  '48/gimp-prefs-folders-tool-plug-ins.png',
  '48/gimp-prefs-folders-tool-presets.png',
  '48/gimp-prefs-folders-tools.png',
  '48/gimp-prefs-folders.png',
  '48/gimp-prefs-help-system.png',
  '48/gimp-prefs-icon-theme.png',
  '48/gimp-prefs-image-title.png',
  '48/gimp-prefs-image-windows.png',
  '48/gimp-prefs-input-devices.png',
  '48/gimp-prefs-interface.png',
  '48/gimp-prefs-new-image.png',
  '48/gimp-prefs-playground.png',
  '48/gimp-prefs-session.png',
  '48/gimp-prefs-system-resources.png',
  '48/gimp-prefs-theme.png',
  '48/gimp-prefs-tool-options.png',
  '48/gimp-prefs-toolbox.png',
  '48/gimp-prefs-window-management.png',
  '48/gimp-text-layer.png',
  '48/gimp-wilber.png',
]
legacy_icons_64 = [
  '64/gimp-error.png',
  '64/gimp-frame.png',
  '64/gimp-info.png',
  '64/gimp-question.png',
  '64/gimp-texture.png',
  '64/gimp-user-manual.png',
  '64/gimp-warning.png',
  '64/gimp-wilber-eek.png',
  '64/gimp-wilber-outline.png',
  '64/gimp-wilber.png',
]
legacy_icons_96 = [
  '96/gimp-wilber-outline.png',
  '96/gimp-wilber.png',
]
legacy_icons_128 = [
  '128/gimp-wilber-outline.png',
  '128/gimp-wilber.png',
]
legacy_icons_192 = [
  '192/gimp-wilber-outline.png',
  '192/gimp-wilber.png',
]
legacy_icons_256 = [
  '256/gimp-wilber-outline.png',
  '256/gimp-wilber.png',
]

all_legacy_icons = [
  [ '12x12',    legacy_icons_12 ],
  [ '16x16',    legacy_icons_16 ],
  [ '18x18',    legacy_icons_18 ],
  [ '20x20',    legacy_icons_20 ],
  [ '22x22',    legacy_icons_22 ],
  [ '24x24',    legacy_icons_24 ],
  [ '32x32',    legacy_icons_32 ],
  [ '48x48',    legacy_icons_48 ],
  [ '64x64',    legacy_icons_64 ],
  [ '96x96',    legacy_icons_96 ],
  [ '128x128',  legacy_icons_128 ],
  [ '192x192',  legacy_icons_192 ],
  [ '256x256',  legacy_icons_256 ],
]
all_legacy_tools = [
  [ '22x22',    legacy_tools_22 ],
]

foreach icon_info : all_legacy_icons
  icons_dir = icon_info[0]
  icons_list= icon_info[1]
  install_data(icons_list,
    install_dir: gimpiconsdir / theme / icons_dir / 'apps',
  )
endforeach
foreach icon_info : all_legacy_tools
  icons_dir = icon_info[0]
  icons_list= icon_info[1]
  install_data(icons_list,
  install_dir: gimpiconsdir / theme / icons_dir / 'tools',
  )
endforeach


icons_core = [ '64/gimp-question.png', ]
icons_imgs = [ '64/gimp-wilber-eek.png', ]

resourcename = 'gimp-core-pixbufs'
xml_content  = '<?xml version="1.0" encoding="UTF-8"?>\n'
xml_content += '<gresources>\n'
xml_content += '  <gresource prefix="/org/gimp/icons">\n'
foreach file : icons_core
  xml_content+='    <file preprocess="to-pixdata">'+ file +'</file>\n'
endforeach
xml_content += '  </gresource>\n'
xml_content += '</gresources>\n'

xml_file = configure_file(
  output: resourcename + '.gresource.xml',
  command: [ 'echo', xml_content ],
  capture: true,
)
# icons_core_sources = gnome.compile_resources(
#   resourcename,
#   xml_file,
#   c_name: resourcename.underscorify(),
# )


resourcename = 'gimp-icon-pixbufs'
xml_content  = '<?xml version="1.0" encoding="UTF-8"?>\n'
xml_content += '<gresources>\n'
xml_content += '  <gresource prefix="/org/gimp/icons">\n'
foreach file : icons_imgs
  xml_content+='    <file preprocess="to-pixdata">'+ file +'</file>\n'
endforeach
xml_content += '  </gresource>\n'
xml_content += '</gresources>\n'

xml_file = configure_file(
  output: resourcename + '.gresource.xml',
  command: [ 'echo', xml_content ],
  capture: true,
)
# icons_imgs_sources = gnome.compile_resources(
#   resourcename,
#   xml_file,
#   c_name: resourcename.underscorify(),
# )
